package com.fileDemo;

import java.io.File;

/**
 * @Author milian
 * @Date 2021/7/27 0027 15:54
 */
public class test2 {
    public static void main(String[] args) {
        File file = new File("H:\\test");
        deleteFile(file);
    }

    private static void deleteFile(File file) {
        File[] filesArray = file.listFiles();
        for (File file1: filesArray
             ) {
            if (file1.isFile()){
                file1.delete();
            }else {
               deleteFile(file1);
            }
        }
        file.delete();
    }
}
